<?php

namespace app\admin\model\dahui;

use think\Model;

class Yewu extends Model
{
    // 表名
    protected $name = 'dahui_yewu';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'businesstype_text'
    ];
    

    
    public function getBusinesstypeList()
    {
        return ['个税' => __('个税'),'公积金' => __('公积金'),'社保' => __('社保'),'补充公积金' => __('补充公积金')];
    }     


    public function getBusinesstypeTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['businesstype']) ? $data['businesstype'] : '');
        $list = $this->getBusinesstypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function kehu()
    {
        return $this->belongsTo('Kehu', 'idnumber', 'idnumber', [], 'LEFT')->setEagerlyType(0);
    }
}
